<template>
	<view>
		<view class="page">
			<view class="head">
				<uv-steps :current="0" inactive-color="#ffffff" active-color="#ffffff">
					<uv-steps-item>
						<template v-slot:icon>
							<view class="renn">
								<view class="rens"></view>
							</view>
						</template>
						<template v-slot:title>
							<text class="ress">01</text>
						</template>
						<template v-slot:desc>
							<text class="ress">提交资料</text>
						</template>
					</uv-steps-item>
					<uv-steps-item>
						<template v-slot:icon>
							<view class="renns ">
								<view class="rens"></view>
							</view>
						</template>
						<template v-slot:title>
							<text class="ress">02</text>
						</template>
						<template v-slot:desc>
							<text class="ress">平台审核</text>
						</template>
					</uv-steps-item>
					<uv-steps-item>
						<template v-slot:icon>
							<view class="renns">
								<view class="rens"></view>
							</view>
						</template>
						<template v-slot:title>
							<text class="ress">03</text>
						</template>
						<template v-slot:desc>
							<text class="ress">微信审核</text>
						</template>
					</uv-steps-item>
					<uv-steps-item>
						<template v-slot:icon>
							<view class="renns">
								<view class="rens"></view>
							</view>
						</template>
						<template v-slot:title>
							<text class="ress">04</text>
						</template>
						<template v-slot:desc>
							<text class="ress">入驻成功</text>
						</template>
					</uv-steps-item>
				</uv-steps>
			</view>
			
			<view class="conter"> 完成以下步骤可申请入驻</view>
			<view class="headstype">
				<view class="types" :class="type == 0 ?'click-type unverified':''" @tap="switchState(0)">商户</view>
				<view class="types" :class="type == 1 ?'click-type verified':''" @tap="switchState(1)">个人</view>
			</view>
			<view class="conterr">
				<view class="shop" @tap="applicationProgress(0)">
					<view>店铺信息</view>
					<view class="shop1 ">
						<view class="text">去录入</view>
						<uni-icons type="right" size="20"></uni-icons>
					</view>
				</view>

				<view class="shop" @tap="applicationProgress(1)">
					<view>资质与法人</view>
					<view class="shop1">
						<view class="text">去录入</view>
						<uni-icons type="right" size="20"></uni-icons>
					</view>
				</view>
	
			</view>
		</view>

		<uni-popup ref="popup" type="center" border-radius="20rpx" mask-click="false" :mask="true"
			mask-background-color="rgba(0,0,0,0.4)">
			<view class="overlay">
				<view class="merchant_agreement">
					<view class="agreement-content">
						<view class="agreement-header">温馨提示</view>
						<view class="agreement-body">
							<p>亲爱的商家,感谢您一直以来的支持!为了更好地保护您的权益,同时遵守相关监管要求,我们更新了<span style="color: red;"
									@tap="onDetails($store.state.common.appConfig.mer_agreement, '商家隐私政策')">《商家隐私政策》</span>及<span
									style="color: red;"
									@tap="onDetails($store.state.common.appConfig.user_agreement, '用户协议')">《用户服务协议》</span>
							</p>
							<p>特向您说明如下:</p>
							<ol>
								<li>为向您提供基本服务,我们会根据您的授权内容,收集和使用对应的必要信息(例如联系电话,位置信息,设备信息等)。为确保服务稳定性，应用处于后台时可能会进行网络请求;
								</li>
								<li>未经您的授权同意,我们不会将您的信息共享给第三方或用于您未授权的其他用途;</li>
								<li>您可以访问,更正,删除相关个人信息,我们也提供账号注销的途径。</li>
							</ol>
						</view>
						<view class="agreement-footer">
							<span class="decline-button" @click="declineAgreement">拒绝</span>
							
							<view class="line"></view>
							
							<span class="accept-button" @click="acceptAgreement">同意</span>
						</view>
					</view>

				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indexs: 2,
				current_index: 0,
				type:0
			};
		},
		mounted() {
			//弹出协议
			const hasAgreed = uni.getStorageSync('hasAgreedToAgreement');
			if (!hasAgreed) {
				this.$refs.popup.open();
			}
		},
		onLoad(options) {
			this.current_index = options.index;
		},
		methods: {
			switchState(type){
				this.type = type
			},
			applicationProgress(curr) {
				console.log(curr,'9888888888888');
				// console.log(1)
				uni.request({
					url: "/wanlshop/shop/user_status",
					method: "POST",
					data:{
						type:this.current_index
					},
					success: res => {
						console.log(res,'9888888888888');
						uni.hideLoading()
						var status;
						if (this.current_index == 1) {
							status = res.data.shop_status;
						} else if (this.current_index == 2) {
							status = res.data.spot_status;
						}
						
						let curre = curr;
						if (status !== -1) {
							curre = 2;
						}
						let type = this.type
						this.$wanlshop.to(
								`/pages/user/applicationProgress/applicationProgress?type=${type}&curr=${curre}&index=${this.current_index}&info=${JSON.stringify(res.data)}`);
					
						
					}
				})
			},
			acceptAgreement() {
				uni.setStorageSync('hasAgreedToAgreement', true);
				this.$refs.popup.close();
			},
			declineAgreement() {
				uni.showToast({
					title: '您需要同意协议才能继续使用',
					icon: 'none'
				});
			},
		}
	};
</script>


<style lang="scss">
	/deep/.uv-steps-item__wrapper {
		background-color: transparent !important;

	}

	/deep/.uv-steps-item__line::after {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -39%);
		width: 99%; // 增加线条宽度以扩展长度
		height: 1px;
		background-color: #ffffff; // 确保颜色与组件设置的颜色一致
	}

	.page {

		.head {
			padding: 25rpx;
			background-color: #E60012;

			.renn {
				margin-left: 10rpx;
				width: 30rpx;
				height: 30rpx;
				background-color: #EF7C85;
				border-radius: 50%;
				display: flex;
				justify-content: center;
				align-items: center;
			}

			.renns {
				margin-left: 10rpx;
			}

			.rens {
				text-align: center;
				width: 15rpx;
				height: 15rpx;
				background-color: white;
				border-radius: 50%;
			}

			.ress {
				color: white;
			}
		}

		background-color: #f6f6f6;

		.conter {
			margin-top: 20rpx;
			padding: 0 20rpx;

			//font-weight: 400;
			font-size: 26rpx;
			color: #333333;
			line-height: 37rpx;
			font-weight: bold;


		}

		.shop {
			margin-top: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			height: 100rpx;
			background-color: #fff;
			padding: 0 20rpx;
			border-bottom: 1px solid #f6f6f6;
			border-radius: 16rpx;

			.shop1 {
				display: flex;
				align-items: center;

				.text {
					color: #bbbbbb;
				}
			}
		}

		.conterr {
			margin-top: 20rpx;
			padding: 0 20rpx;
		}
	}
	
	.uni-popup {
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.overlay {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background: rgba(0, 0, 0, 0.5);
		/* 黑色遮罩层，透明度为0.5 */
		display: flex;
		align-items: center;
		justify-content: center;
		z-index: 1000;
	}
	
	.merchant_agreement {
		padding: 40rpx;
		border-radius: 20rpx;
	}
	
	.agreement-content {
		background-color: #ffffff;
		padding: 60rpx 60rpx 0 60rpx;
		border-radius: 20rpx;
	}
	
	.agreement-header {
		font-size: 36rpx;
		font-weight: bold;
		margin-bottom: 20rpx;
		text-align: center;
	}
	
	.agreement-body {
		font-size: 28rpx;
		margin-bottom: 20rpx;
	}
	
	.agreement-body p {
		margin-bottom: 20rpx;
	}
	
	.agreement-footer {
		margin-left: -60rpx;
		width: calc(100% + 120rpx);
		display: flex;
		justify-content: space-between;
		padding: 40rpx;
		border-top: 2rpx solid #EEEEEE;
	}
	
	.agreement-footer .line {
		width: 2rpx;
		height: 35rpx;
		background-color: #eeeeee;
	}
	
	.agreement-footer span {
		flex: 1;
		border: none;
		font-size: 28rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	
	
	.decline-button {
		background-color: #ffffff;
		color: #888888;
		font-size: 30rpx;
	}
	
	.accept-button {
		background-color: #ffffff;
		color: #E60012;
		font-size: 30rpx;
	}
	.headstype {
		margin-top: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		border: 1px solid #E60012;
		height: 92rpx;
		background-color: #ffffff;
		border-radius: 16rpx;
		margin: 11px 11px;
	}
	
	.types {
		height: 100%;
		width: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
		color: #E60012;
	}
	.click-type{
		color: #ffffff;
		background-color: #E60012;
	}
	.unverified{
		border-top-left-radius: 7px;
		border-bottom-left-radius: 7px;
	}
	.verified {
	    border-top-right-radius: 7px;
	    border-bottom-right-radius: 7px;
	}
</style>